import Vue from 'vue'

import Cookies from 'js-cookie'

import Element from 'element-ui'
import './assets/styles/element-variables.scss'
import './assets/icon/iconfont.css'

import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ruoyi.scss' // ruoyi css
import App from './App'
import store from './store'
import router from './router'
import permission from './directive/permission'
import { download, getdownload } from '@/utils/request'
import tools from './utils/Tools'
import ol from 'openlayers' // 地图组件引入
import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from '@/api/system/dict/data'
import { getConfigKey } from '@/api/system/config'
import { parseTime, resetForm, choseDateRange, addDateRange, selectDictLabel, selectDictLabels, selectlable, handleTree, handleTreeAble, Dictionary, phonenumber, cardIdNumber } from '@/utils/ruoyi'
import Pagination from '@/components/Pagination'
import ExportFile from '@/components/exportFile/exportFile'
// 自定义表格工具扩展
import RightToolbar from '@/components/RightToolbar'
import ButSelf from '@/components/ButSelf'
import i18n from './utils/lang/index'
// import openlayersComponents from 'openlayers-components'
import fifle from './utils/filters.js'
import dataV from '@jiaminghi/data-view'
Vue.use(dataV)
Vue.use(tools)
// Vue.use(openlayersComponents)
Vue.use(i18n)
// 全局方法挂载

Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime
Vue.prototype.Dictionary = Dictionary
Vue.prototype.phonenumber = phonenumber
Vue.prototype.cardIdNumber = cardIdNumber

Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.choseDateRange = choseDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.selectlable = selectlable

Vue.prototype.download = download
Vue.prototype.getdownload = getdownload
Vue.prototype.handleTree = handleTree
Vue.prototype.handleTreeAble = handleTreeAble

Vue.prototype.msgSuccess = function(msg) {
  this.$message({ showClose: true, message: msg, type: 'success' })
}

Vue.prototype.msgError = function(msg) {
  this.$message({ showClose: true, message: msg, type: 'error' })
}

Vue.prototype.msgInfo = function(msg) {
  this.$message.info(msg)
}

// 全局组件挂载
Vue.component('Pagination', Pagination)
Vue.component('ExportFile', ExportFile)
Vue.component('RightToolbar', RightToolbar)
Vue.component('ButSelf', ButSelf)

Vue.use(permission)
Vue.use(fifle)
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */

Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  i18n,
  store,
  render: h => h(App)
})
